function gridjabatan(varalamatds, baseurl) {
    if (typeof myTable == 'undefined') {
        myTable = $('#jabatantable').dataTable({
            "bPaginate": true,
            "sPaginationType": "bootstrap",
            "bJQueryUI": false,
            "bProcessing": true,
            "bServerSide": true,
            "bInfo": true,
            "sScrollY": (0.5 * $(window).height()),
            "fnServerParams": function(aoData) {
                var eselonarr = [];
                $('#eselonfilter :selected').each(function(i, selected) {
                    eselonarr[i] = $(selected).val();
                });
                var jenisjabatanarr = [];
                $('#jenisjabatanfilter :selected').each(function(i, selected) {
                    jenisjabatanarr[i] = $(selected).val();
                });

                //----------------
                aoData.push({name: "nama", value: $("#namajabatanfilter").val()},
                {name: "eselon", value: eselonarr},
                {name: "struk", value: $.inArray("2", jenisjabatanarr) === -1 ? '-' : 2},
                {name: "fu", value: $.inArray("4", jenisjabatanarr)=== -1 ? '-' : 4  },
                {name: "ft", value: $.inArray("3", jenisjabatanarr)=== -1 ? '-' : 3 }
                );
                eselonarr = null;
            },
            "bFilter": false,
            "sAjaxSource": varalamatds,
            "fnServerData": function(sSource, aoData, fnCallback) {
                $.ajax({
                    "dataType": 'json',
                    "type": "POST",
                    "url": sSource,
                    "data": aoData,
                    "success": fnCallback
                });
            },
            "fnRowCallback": function(nRow, aData, iDisplayIndex) {
                var link = '<a class="fancybox  fancybox.iframe" href="'+baseurl+'index.php/personil/personildata/popuppegbyjabatan/'+aData['jabatan_id']+'" title="Data pegawsai berdasarkan jabatan">'+aData['jabatan_nama']+'</a>'; 
                $('td:eq(0)', nRow).html(link);
                return nRow;
            },
            "aoColumns": [
                {"mDataProp": "jabatan_nama"},
                {"mDataProp": "jabatan_jenis"},
                {"mDataProp": "eselon_nm"},
                {"mDataProp": "jabatan_bup", sClass: "right"},
                {"mDataProp": "jumlah_rill", sClass: "right"}
            ]
        });
        setTimeout(function()
        {
            myTable.fnAdjustColumnSizing();
        }, 10);
    }
    else
    {
        myTable.fnClearTable(0);
        myTable.fnDraw();
    }
    $('.dataTable').wrap('<div class="dataTables_scroll" />');

}

function cari() {

    $("#jenisjabatanfilter").multiselect({
        minWidth: 125,
        checkAllText: 'Check all',
        uncheckAllText: 'Uncheck all',
        noneSelectedText: 'Pilih Data',
        selectedText: '# telah dipilih'

    });
    $("#eselonfilter").multiselect({
        minWidth: 125,
        checkAllText: 'Check all',
        uncheckAllText: 'Uncheck all',
        noneSelectedText: 'Pilih Data',
        selectedText: '# telah dipilih'

    });

    $('#namajabatanfilter').on('keyup', function(event) {
        var panjang = parseInt($(this).val().length);
        // var keycode = (event.keyCode ? event.keyCode : event.which);
        if (/*keycode == '13' &&*/ panjang >= 3) {
            tampil();
        }
    });


}
